/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.xtd.model.inventory;

import com.xtd.model.employment.DepartmentPost;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Lu Yuanbin
 */
@Entity
@Table(name = "commodity_royalty")
@NamedQueries({
    @NamedQuery(name = "CommodityRoyalty.findAll", query = "SELECT c FROM CommodityRoyalty c")})
public class CommodityRoyalty implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
   
    @Column(name = "quantity_royalty")
    private BigDecimal quantityRoyalty;
    @Column(name = "price_royalty")
    private BigDecimal priceRoyalty;
    @JoinColumn(name = "department_post", referencedColumnName = "id", insertable = true, updatable = true)
    @ManyToOne
    private DepartmentPost departmentPost;
    @JoinColumn(name = "commodity", referencedColumnName = "id", insertable = true, updatable = true)
    @ManyToOne
    private Commodity commodity;

    public CommodityRoyalty() {
    }

    public CommodityRoyalty(Commodity commodity, DepartmentPost departmentPost) {
        this.commodity = commodity;
        this.departmentPost = departmentPost;

    }

    public CommodityRoyalty(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

 

    public DepartmentPost getDepartmentPost() {
        return departmentPost;
    }

    public void setDepartmentPost(DepartmentPost departmentPost) {
        this.departmentPost = departmentPost;
    }

    public Commodity getCommodity() {
        return commodity;
    }

    public void setCommodity(Commodity commodity) {
        this.commodity = commodity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CommodityRoyalty)) {
            return false;
        }
        CommodityRoyalty other = (CommodityRoyalty) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))|| (this.id == null && other == null && this != other)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.xtd.view.inventory.CommodityRoyalty[id=" + id + "]";
    }

    /**
     * @return the quantityRoyalty
     */
    public BigDecimal getQuantityRoyalty() {
        return quantityRoyalty;
    }

    /**
     * @param quantityRoyalty the quantityRoyalty to set
     */
    public void setQuantityRoyalty(BigDecimal quantityRoyalty) {
        this.quantityRoyalty = quantityRoyalty;
    }

    /**
     * @return the priceRoyalty
     */
    public BigDecimal getPriceRoyalty() {
        return priceRoyalty;
    }

    /**
     * @param priceRoyalty the priceRoyalty to set
     */
    public void setPriceRoyalty(BigDecimal priceRoyalty) {
        this.priceRoyalty = priceRoyalty;
    }
}
